#include <stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        if (i < 10)
            printf("%d\n", i);
        else
        {
            int j = i, sum = 0, g[6];
            while (j)
            {
                g[sum] = j % 10;
                j = j / 10;
                sum++;
            }
            int flag = 1;
            for (int y = 0; y < sum / 2; y++)
            {
                if (g[y] != g[sum - 1 - y])
                    flag = 0;
            }
            if (flag)
                printf("%d\n", i);
        }
    }
    return 0;
}